package com.demo.config;

import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

import java.util.Arrays;
import java.util.List;

@Component
public class SwaagerConfig implements SwaggerResourcesProvider {

    @Override
    public List<SwaggerResource> get() {
        return Arrays.asList(
                create("订单服务","/orderserver/v2/api-docs"),
                create("产品服务","/movieserver/v2/api-docs"),
                create("影院服务","/cinemaserver/v2/api-docs"),
                create("用户服务","/userserver/v2/api-docs")
        );
    }

    private SwaggerResource create(String name,String url) {
        SwaggerResource sr = new SwaggerResource();
        sr.setName(name);
        sr.setUrl(url);
        sr.setSwaggerVersion("2.0");
        return sr;
    }

}
